package com.huika.dealontop.config;


import com.huika.dealontop.utils.PreferHelper;
import com.huika.dealontop.utils.PreferencesHelper;

/**
 * 网络地址配置
 *
 * @author fanxing 创建于 Mar 18, 2015
 */
public class UrlConstants {
    public static String ServerName = getServerDomain();
//	 惠卡公司地址
//	public static final LatLng HUIKA_LOCATION = new LatLng(22.602686,
//			114.057427);

    /** 以下变量在环境切换时需要变更 *****************************************************/
    /**
     * 通用日志标签
     */
    public static final String DEBUG_TAG = "DealOnTop";
    /**
     * 是否打印日志信息
     */
    public static final boolean IS_LOG = true;

    /**
     * 正式版本的环境
     */
    //public static final String RELEASE_SERVER_DOMAIN = "http://121.199.22.45:1080/rrcpro-api/";
    public static final String RELEASE_SERVER_DOMAIN = "http://api.dealontop.com/";
    /**
     * 真实数据的测试环境
     */
    public static final String RELEASE_TEST_SERVER_DOMAIN = "http://192.168.18.83:9090/";
    /**
     * 测试版本的环境
     */
    public static final String TEST_SERVER_DOMAIN = "http://192.168.18.83:9090/";

//	public static final String HOST = "http://121.199.22.45:1080/rrcpro-api/";
//	public static final String HOST = "http://192.168.16.219:8082/rrcpro-api/";//测试服务器
//	public static final String HOST = "http://192.168.21.103:8080/rrcpro-api/";
    // public static final String HOST ="http://192.168.17.83:8080/rrcpro-api/";
//	public static final String HOST ="http://192.168.17.237:8080/rrcpro-api/";//杨俊
    //public static final String HOST ="http://192.168.16.219:8183/rrcpro-api/";//预生产
    /**
     * 以上变量在环境切换时需要变更
     *****************************************************/

    public static final String HOST = ServerName;


    /**
     * 获取项目列表
     */
//	public static final String URL_FIND_PROJECTS = HOST + "projectService/GetAllProjectList";
    //TODO 测试环境
    public static final boolean isReleaseEnvironment() {
        return PreferHelper.getInstance().getBoolean(Constants.IS_RELEASE_ENVIRONMENT, true);
    }

    private static final boolean isReleaseTestEnvironment() {
        return PreferHelper.getInstance().getBoolean(Constants.IS_RELEASE_TEST_ENVIRONMENT, false);
    }

    private static final String getServerDomain() {
        if (isReleaseEnvironment()) {
            return RELEASE_SERVER_DOMAIN;
        } else {
            if (isReleaseTestEnvironment()) {
                return RELEASE_TEST_SERVER_DOMAIN;
            } else {
                return TEST_SERVER_DOMAIN;
            }
        }
    }


    public static String getHost() {
        String hostFlag = PreferencesHelper.getString(PreferencesHelper.KEY_ENVIRONMENT);
        String host = "";
        if (hostFlag.equals("test") || hostFlag.equals("")) {
            host = TEST_SERVER_DOMAIN;
        } else if (hostFlag.equals("pre")) {
            host = RELEASE_TEST_SERVER_DOMAIN;
        } else if (hostFlag.equals("official")) {
            host = RELEASE_SERVER_DOMAIN;
        } else if (hostFlag.equals("yangjun")) {
            host = "http://192.168.17.237:8080/rrcpro-api/";
        }
        return host;
    }

    /**
     * 登陆验证
     */
    public static final String LOGINVALIDATEFORUSERAPP = HOST + "/Member/MemberLoginValidate";
    /**
     * 注册-获取短信验证码
     */
    public static final String GETSMSVERIFICATION = HOST + "Member/MemberSMSValidate";
    /**
     * 注册
     */
    public static final String REGISTER = HOST + "/Member/MemberRegister";
    /**
     * 给邮箱用户添加手机号码的接口
     */
    public static final String MAILADDPHONE = HOST + "/Member/MemberEmailInfoPerfect";
    /**
     * 找回密码
     */
    public static final String FINDPASSWORDCHECKCODE = HOST + "/Member/MemberRetrievePassword";
    /**
     * 轮播图图片
     */
    public static final String HOMEBANNERLIST = HOST + "/Home/BannerList";
    /**
     * AppIcon图片
     */
    public static final String HOMEAPPICON = HOST + "/Home/AppIcon";
    /**
     * 轮播图图片
     */
    public static final String HOMEBUYLIMIT = HOST + "/Home/HomeBuyLimit";
    /**
     * 4个广告图片的地址
     */
    public static final String FOURADVERTISEMENT = HOST + "/Home/Advertisement";
    /**
     * DealonTop用户协议
     */
    public static final String DEALONTOPURL = HOST + "/html5/about_cn/about4.html";
    public static final String DEALONTOPURLEN = HOST + "/html5/about_en/about4.html";
    public static final String DEALONTOPURLTH = HOST + "/html5/about_th/about4.html";


    /**
     * 广告登录
     */
    public static final String HOMEADVERTISEMENT = "/Home/Advertisement";

    /**
     * 找回密码-重新设置密码
     */
    public static final String FINDPASSWORDRESET = HOST + "phoneMessage/FindPasswordReset";
    /**
     * 绑定手机-发送验证码
     */
    public static final String GETMSGBINDNEWPHONEGETCODEREQ = HOST + "phoneMessage/GetMsgBindNewPhoneGetCodeReq";
    /**
     * 绑定手机
     */
    public static final String BANDINGPHONE = HOST + "userservice/BandingPhone";
    /**
     * 更新绑定手机发送验证码(确认原绑定手机是否准确)
     */
    public static final String GETMSGBINDCHANGEPHONEGETCODEREQ = HOST + "phoneMessage/GetMsgBindChangePhoneGetCodeReq";
    /**
     * 更绑手机-验证（确认原绑定手机是否准确）
     */
    public static final String CHANGEPHONECHECK = HOST + "phoneMessage/ChangePhoneCheck";
    /**
     * 修改登陆密码
     */
    public static final String CHANGELOGINPASSWORD = HOST + "userservice/ChangeLoginPassword";
    /**
     * 更新应用
     */
    public static final String GETVERSIONINFO = HOST + "Other/GetVersionInfo";
    /**
     * 修改基本资料
     */
    public static final String UPDATE_INFO = HOST + "Member/MemberUpdateInfo";
    /**
     * 修改密码
     */
    public static final String UPDATE_PASSWORD = HOST + "Member/MemberUpdatePassword";
    /**
     * 修改手机
     */
    public static final String UPDATE_PHONE = HOST + "Member/MemberUpdatePhone";
    /**
     * 修改邮箱
     */
    public static final String UPDATE_EMAIL = HOST + "Member/MemberUpdateEmail";
    /**
     * 上传图片
     */
    public static final String UPLOAD_IMAGE = HOST + "Member/UploadImage";
    /**
     * 更改头像
     */
    public static final String UPDATE_HEAD_IMAGE = HOST + "Member/MemberUpdateHeadImage";
    /**
     * 退款界面
     */
    public static final String MEMBERREIMBURSE = HOST + "/Order/MemberReimburse";
    /**
     * 意见反馈
     */
    public static final String MEMBERFEEDBACK = HOST + "Member/MemberFeedBack";
    /**
     * 我的优惠券
     */
    public static final String MEMBERDISCOUNTCOICOUPON = HOST + "Shop/MemberDiscountCoupon";
    /**
     * 获取购物车
     */
    public static final String MYSHOPPINGCART = HOST + "/Cart/MyShoppingCart";
    /**
     * 是否勾选
     */
    public static final String SELECTGOODS = HOST + "/Cart/SelectGoods";
    /**
     * 更新购物车
     */
    public static final String UPDATECARTPRODUCT = HOST + "/Cart/UpdateCartProduct";
    /**
     * 移除购物车
     */
    public static final String DELETECARTPRODUCT = HOST + "/Cart/DeleteCartProduct";
    /**
     * 购物车提交订单
     */
    public static final String SUBMITORDER = HOST + "/Cart/SubmitOrder";
    /**
     * 提交订单
     */
    public static final String GENERATEORDER = HOST + "Order/GenerateOrder";
    /**
     * 使用优惠券
     */
    public static final String USEDISCOUNTCOUP = HOST + "Shop/UseDiscountCoup";
    /**
     * 获得优惠券
     */
    public static final String GAINDISCOUNTCOUP = HOST + "/Shop/GainDiscountCoup";
    /**
     * 获取用户信息
     */
    public static final String GETUSERINFO = HOST + "Member/GainMemberInfo";
    /**
     * 获取商品分类
     */
    public static final String GETCATEGORIES = HOST + "Product/GetCategories";
    /**
     * 获取地区分类列表
     */
    public static final String GETAREAS = HOST + "Product/GetAreas";
    /**
     * 身边(附近)团购
     */
    public static final String NEARBYGROUPON = HOST + "/Product/NearbyGrouponPro";
    /**
     * 身边(附近)商家
     */
    public static final String NEARBYGROUPONMER = HOST + "/Product/NearbyGrouponMer";
    /*我的訂單*/
    public static final String MYORDERBOOK = HOST + "/Order/MemberOrderList";
    /**
     * 身边(限时)团购
     */
    public static final String BUYLIMITPRODUCTLIST = HOST + "Product/BuyLimitProductList";
    /**
     * 身边(限时)商家
     */
    public static final String BUYLIMITMERCHANTLIST = HOST + "Product/BuyLimitMerchantList";
    /**
     * 商家主页头部
     */
    public static final String MERCHANTDETAIL = HOST + "/Product/MerchantDetail";
    /**
     * 商家主页其它团购商品
     */
    public static final String OTHERGROUPONLIST = HOST + "/Product/OtherGrouponList";
    /**
     * 商家主页评论列表
     */
    public static final String USEREVALUATION = HOST + "/Product/UserEvaluation";
    /**
     * 搜索页面
     */
    public static final String SEARCHCONTENT = HOST + "/Product/SearchContent";
    /**
     * 评论详情页面
     */
    public static final String MEMBEREVALUATEDETAIL = HOST + "/Product/MemberEvaluateDetail";


    /**
     * 订单处理结果
     */
    public static final String ORDERPROCESSRESULT = HOST + "Order/OrderProcessResult";
    /**
     * 判断paypal支付是否成功
     */
    public static final String PAYMENTSUCCESS = HOST + "Payment/PaymentSuccess";
    /**
     * 我的评价
     */
    public static final String MEMBEREVALUATELIST = HOST + "Product/MemberEvaluateList";
    /**
     * 商品详情
     */
    public static final String PRODUCT_DETAIL = HOST + "Product/ProductDetail";
    /**
     * 添加商品到购物车
     */
    public static final String ADD_TO_CART = HOST + "Cart/AddCartProduct";
    /**
     * 订单详情
     */
    public static final String ORDER_DETAIL = HOST + "Order/MemberOrderDetail";
    /**
     * omise支付
     */
    public static final String OMISEPAYMENT = HOST + "Payment/OmisePayment";
    /**
     * 评价
     */
    public static final String SHOPEVALUATE = HOST + "Product/ShopEvaluate";
    /**
     * 未收到团购码短信
     */
    public static final String RESENDTICKETMSG = HOST + "Payment/ReSendTicketMsg";
    /**
     * 获取商品通用分店列表
     */
    public static final String GETPRODUCTIDMERCHANTINFO = HOST + "Cart/GetProductIdMerchantInfo";
    /**
     * 跳转到PaysBuy支付页
     */
    public static final String PASYSBUYSERVRES = HOST + "Payment/PasysBuyservres";

    /**
     * 根据支付订单号获取团购码
     */
    public static final String SELECTCODE = HOST + "Payment/SelectCode";


    /**
     * 重新获取支付单号
     */
    public static final String REPAYMENT = HOST + "Payment/RePayment";

}
